{%  load static  %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="{% static 'plugins/bootstrap-3.3.7-dist/css/bootstrap.min.css' %}">
</head>
<body>

    <div class="container">

        <h1>书籍展示</h1>
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <a href="/add_book/" class="btn btn-primary">添加书籍</a>
                <table style='margin-top:10px' class="table table-bordered table-striped table-hover">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>书籍名称</th>
                        <th>价格</th>
                        <th>出版日期</th>
                        <th>出版社</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for book in books %}
                    <tr>
                        <td>{{ forloop.counter }}</td>
                        <td>{{ book.title }}</td>
                        <td>{{ book.price }}</td>
                        <td>{{ book.pub_date|date:'Y-m-d' }}</td>
                        <td>{{ book.publish }}</td>
                        <td>
                            <a href="{% url 'edit_book' book.id %}" class="btn btn-warning">编辑</a>
                            <a href="{% url 'delete_book' book.id %}" class="btn btn-danger">删除</a>
                        </td>

                    </tr>
                    {% endfor %}

                    </tbody>
                </table>


            </div>
        </div>
    </div>

</body>
</html>